# @Author  : haomh
# @Time    : 2025-10-22 17:22
# @Function:

# 计算1-100的和
# i = 1
# result = 0
# while i <= 100:
#     result += i
#     i += 1
# print(result)

# 应用2：计算1-100偶数累加和
j = 1
res1 = 0
while j <= 100:
    if j % 2 == 0:
        res1 += j
    j += 1
print(res1)

# 方法2：计数器控制
k = 0
res2 =0
while k <= 100:
    res2 += k
    k +=2
print(res2)
